package demo.spring.framework.beans.factory.config;

import java.io.IOException;
import java.util.Properties;

import org.junit.Test;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamResource;

public class YamlDemo {

    @Test
    public void test1() throws IOException {
        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
        ClassPathResource cpr = new ClassPathResource("saturn.yml");
        InputStreamResource ins = new InputStreamResource(cpr.getInputStream());
        yaml.setResources(ins);
        Properties properties = yaml.getObject();
        System.out.println(properties.getProperty("aa"));
    }
}
